package com.entity.serviceorder;

import com.baomidou.mybatisplus.annotation.*;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.AllArgsConstructor;

import java.math.BigDecimal;
import java.sql.Timestamp;

@Data
@NoArgsConstructor
@AllArgsConstructor
@TableName("service_order_products") // 映射到数据库表名
@ApiModel("服务单产品中间表实体类")
public class ServiceOrderProduct {

    @ApiModelProperty(value = "主键，唯一标识每条记录")
    @TableId(value = "id", type = IdType.AUTO)
    private Long id;

    @ApiModelProperty(value = "服务单ID（外键，关联到 service_orders 表）")
    @TableField("service_order_id")
    private Long serviceOrderId;

    @ApiModelProperty(value = "设备ID（外键，关联到 products 表）")
    @TableField("product_id")
    private Long productId;

    @ApiModelProperty(value = "设备数量")
    @TableField("quantity")
    private Integer quantity;

    @ApiModelProperty(value = "备注信息")
    @TableField("remark")
    private String remark;

    @ApiModelProperty(value = "价格合计")
    @TableField("prices_total")
    private BigDecimal pricesTotal;

    @ApiModelProperty(value = "创建时间，默认为当前时间")
    @TableField(value = "create_time", fill = FieldFill.INSERT)
    private Timestamp createTime;

    @ApiModelProperty(value = "更新时间，每次更新时自动刷新")
    @TableField(value = "update_time", fill = FieldFill.INSERT_UPDATE)
    private Timestamp updateTime;
}